import { CommonModal } from "@/views/components/CommonModal";
import CommonTextarea from "@/pages/OrderModule/common/components/CommonTextarea";
import { updateOutboundRemark } from "../../../service";
import { Form, message } from "antd";
const OrderRemarksModal = props => {
	const { data, onCancel, fetchList } = props;
	console.log("props", props);
	const [form] = Form.useForm();

	const onOk = () => {
		updateOutboundRemark({ outboundNo: data.row.outboundNo, orderRemark: form.getFieldValue("orderRemark") }).then(res => {
			const { success } = res;
			if (success) {
				message.success("修改成功");
				onCancel();
				fetchList();
			}
		});
	};
	return (
		<CommonModal title={{ title: `修改备注` }} open={true} width="528px" onOk={onOk} onCancel={onCancel}>
			<Form initialValues={{}} form={form}>
				<Form.Item
					name="orderRemark"
					initialValue={data.row.orderRemark}
					// rules={[{ required: true, message: `请输入订单备注` }]}
				>
					<CommonTextarea showCount maxLength={100} placeholder={`请输入订单备注`} rows={4} />
				</Form.Item>
			</Form>
		</CommonModal>
	);
};

export default OrderRemarksModal;
